UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPnvumAehpp0c69JfAt81ixmDumX3QRBYFDK4SZukEY=' 
WHERE 
  key_id = '0dd2aaa6b68cf28d6acc1349c5fa9523b02e172301632226bf4710583f2f5bb0' 
  AND (
    token = 'lPnvumAehpp0c69JfAt81ixmDumX3QRBYFDK4SZukEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027