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

Query time 0.00043