UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qypOKofL616dfpNl1i8VYrQW/8IZDntfUe+eh1V+QeY=' 
WHERE 
  key_id = 'f992ea088821364f0fdad21dc44b396162ec3ddb1d5aa0b2495c153137d84ee7' 
  AND (
    token = 'qypOKofL616dfpNl1i8VYrQW/8IZDntfUe+eh1V+QeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052