UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ybkyzKwOa+d1i9sg6yen/TcpmOkI8RTp8U+ooWwLAdM=' 
WHERE 
  key_id = '006911cca2a0b38d84a578409fff2878842563efdcfd7bc9f5f418dd34eb10c4' 
  AND (
    token = 'ybkyzKwOa+d1i9sg6yen/TcpmOkI8RTp8U+ooWwLAdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047