UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '72KcblC8uMIjLKp4a5RcJMSg97LK7RRPQOJaPABx218=' 
WHERE 
  key_id = '2fea0d161e11ace8ec187ac880df5de319a70133a35c4b485a26790824ac2e49' 
  AND (
    token = '72KcblC8uMIjLKp4a5RcJMSg97LK7RRPQOJaPABx218=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034