UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKkhULFo4Vmiwhn5l7nqWWEbywboQlfBkhdweQxa1R0=' 
WHERE 
  key_id = '25f860918ad131133a2472ce324f0b933f0902f99458b4b0f6667674e4379932' 
  AND (
    token = 'YKkhULFo4Vmiwhn5l7nqWWEbywboQlfBkhdweQxa1R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034