UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uZj7kfIszDSCCe/ape+p64bSpSpl/loDrS6wqEWakFw=' 
WHERE 
  key_id = '5a4ca19173ac5897a83207f89636f40ad067dc9f702c903fcc5b2526f8921a51' 
  AND (
    token = 'uZj7kfIszDSCCe/ape+p64bSpSpl/loDrS6wqEWakFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032