UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UOWAXNIzpVPRv6kauKctATVm37WwvY7d5vZ1+b1KRgQ=' 
WHERE 
  key_id = '37b02ff9f4044947f345b90cab5451808859b38c4d00fb2e210e964df675f6dc' 
  AND (
    token = 'UOWAXNIzpVPRv6kauKctATVm37WwvY7d5vZ1+b1KRgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042