UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9q7UtwTyYDKsQ4QivsXJirJrw1U/ASJdcee8xRbfEdg=' 
WHERE 
  key_id = 'f91692a80c6522f2b71e364c2571395950e07dde9916f5cb9ffec8f124483699' 
  AND (
    token = '9q7UtwTyYDKsQ4QivsXJirJrw1U/ASJdcee8xRbfEdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034