UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BITM9bLrzaR3ZjykegQTY1JW8clnieb02fu/5XncE+c=' 
WHERE 
  key_id = 'b638bcc31f107751090ad881b3d485c0dd40ec653fc2b91df62a852504dc4a78' 
  AND (
    token = 'BITM9bLrzaR3ZjykegQTY1JW8clnieb02fu/5XncE+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027