UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rvDWzPoSLI43mA6p2MzjB5ZdiNFLFfvOyMQpnBlsAls=' 
WHERE 
  key_id = 'eecacd9976fb8b7021c1ae3fbe4238d68b9a77cab20530b88c108eb590fedec4' 
  AND (
    token = 'rvDWzPoSLI43mA6p2MzjB5ZdiNFLFfvOyMQpnBlsAls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030