UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gUwI4ei9ZHuHNaeMqimn0OFNcKPCBfSjQ5R9yn+ctFU=' 
WHERE 
  key_id = 'd5675bbdf3589a07229a474ac38b987b18da4eae3f79867d96623134a549eb76' 
  AND (
    token = 'gUwI4ei9ZHuHNaeMqimn0OFNcKPCBfSjQ5R9yn+ctFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028