UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RC6ayRjvtcfhotSdxkM1gj4oyAjF90Z1nvyQxqpTPdA=' 
WHERE 
  key_id = '17bb15c6560c44fa08dbed3820edf478c558a44464c1ebcb18401c203b430907' 
  AND (
    token = 'RC6ayRjvtcfhotSdxkM1gj4oyAjF90Z1nvyQxqpTPdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034