UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1pH6dui2Xe0wQK4iBPZbZfJrB/7o1zNTUuCbveJTUcc=' 
WHERE 
  key_id = 'b2eafd5a9738abb8befc6b3ac8eb03fa23437057200d54d11eeadff46d4b8e6e' 
  AND (
    token = '1pH6dui2Xe0wQK4iBPZbZfJrB/7o1zNTUuCbveJTUcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032