UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OMu9ZLb4ZwW2Zfybr+a2JUuHaq0zFBt0TJrevfYH/nY=' 
WHERE 
  key_id = '1f96c23471223e9aa0b0fec85a50e64520252ab0098505a550428032bb1021c6' 
  AND (
    token = 'OMu9ZLb4ZwW2Zfybr+a2JUuHaq0zFBt0TJrevfYH/nY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039