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

Query time 0.00024