UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rs1K1uQrAhCgfNdHQlh23Mu9FJcP6uDJueO7fQ/KiCI=' 
WHERE 
  key_id = 'dd54ca80c7b7a24e4252ce7413c407392788eb600d1b70263a12e552a55b4afc' 
  AND (
    token = 'rs1K1uQrAhCgfNdHQlh23Mu9FJcP6uDJueO7fQ/KiCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043