UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's+aS/BU5ZXg4Vv7IDzrGEoOeowlVOnffGb3S0D+XYWI=' 
WHERE 
  key_id = 'e3b1f2b3b985cf2820341f7e1f04d0e8ed360a333f544450c3f054767385757f' 
  AND (
    token = 's+aS/BU5ZXg4Vv7IDzrGEoOeowlVOnffGb3S0D+XYWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023