UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bTE04X3b8wM3Dgmwenq64UeaGFGu+aC5fsyCIWDYOus=' 
WHERE 
  key_id = '26e90c653cde697b5240cf857bb121f29b53efe506e284173a25bb16c3eab2f3' 
  AND (
    token = 'bTE04X3b8wM3Dgmwenq64UeaGFGu+aC5fsyCIWDYOus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034