UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nu8lpEObWYA+udTPnTHds19Ke8aCX/pQH32s18KhLzo=' 
WHERE 
  key_id = '957d5bd17551738b620d28ab628035919ce6ec02a06f74cd2f7a246130a7bafd' 
  AND (
    token = 'Nu8lpEObWYA+udTPnTHds19Ke8aCX/pQH32s18KhLzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030