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

Query time 0.00033