UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xWC6/rPewmfabaJBefajCQihUC+1+BuvMBlhcAdc2wQ=' 
WHERE 
  key_id = '8d96d05163c527fe9ca92ef9e26d4c1851d71f52d026c677ec3cfea30d68f9ae' 
  AND (
    token = 'xWC6/rPewmfabaJBefajCQihUC+1+BuvMBlhcAdc2wQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031